#include <bits/stdc++.h>
#define ll long long
#define isok cout << "ok" << endl
#define db(s,a) cout << s << ":" << a << endl
#define dbarr(a,n) for(ll i=1;i<=n;i++) cout << a[i] << " " ; cout << endl
#define read(n) scanf("%lld",&n)
#define write(n) printf("%lld",(n))
using namespace std ;
ll n , i , l = 1 , cnt , tot , r[100005] , gj[100005] , ist[100005] , t[100005] ;
set<ll> s ;
int main(){
    freopen("duel.in","r",stdin) ;
    freopen("duel.out","w",stdout) ;
    read(n) ;
    for(i=1;i<=n;i++){
        read(r[i]) ;
        gj[r[i]]++ ;
        ist[r[i]]++ ;
        s.insert(r[i]) ;
    }
    for(auto &&k : s){
        t[++tot] = k ;
    }
    sort(r+1,r+1+n) ;
    for(i=1;i<=n;i++){
        if(!ist[r[i]]){
            continue ;
        }
        while((l<=tot && t[l]<=r[i]) || (t[l]>r[i] && !gj[t[l]])){
            l++ ;
        }
        if(l>tot){
            break ;
        }
        cnt++ ;
        ist[r[i]]-- ;
        gj[t[l]]-- ;
    }
    write(n-cnt) ;
    return 0 ;
}
